﻿using AutoMapper;
using Common.Communal;
using ERP.Domain.Scheduling;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Scheduling.Api.Write.Application.Command.CalendarCommand;
using Scheduling.Api.Write.Application.Command.TeamCommand;
using Scheduling.Api.Write.Application.Command.TeamMemberCommand;
using Scheduling.Api.Write.Application.Command.TeamTypeCommand;
using Scheduling.Api.Write.Application.Command.ShiftCommand;
using Scheduling.Api.Write.Application.Command.ScheduleCommand;
using Scheduling.Services.TeamTypes;

namespace Scheduling.Api.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TeamController : ControllerBase
    {
        public TeamController(IMediator mediator)
        {
            Mediator = mediator;
        }

        public IMediator Mediator { get; }
        [HttpPost]
        public async Task<ApiResult<int>> AddTeam(TeamAddCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> UpdTeam(TeamUpdCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelTeam([FromQuery]TeamDelCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> AddTeamType(TeamTypeAddCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> UpdTeamType(TeamTypeUpdCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelTeamType([FromQuery]TeamTypeDelCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> AddTeamMenber(TeamMemberAddCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> UpdTeamMember(TeamMemberUpdCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelTeamMember([FromQuery]TeamMemberDelCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> AddCalender(CalendarAddCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
        [HttpPost]
        public async Task<ApiResult<int>> UpdCalender(CalendarUpdCommand request, CancellationToken cancellationToken)
        {
            return await Mediator.Send(request);
        }
		[HttpPost]
		public async Task<ApiResult<int>> AddShift(IShiftAddCommand request, CancellationToken cancellationToken)
		{
			return await Mediator.Send(request);
		}
		[HttpPost]
		public async Task<ApiResult<int>> UpdShift(IShiftUpdCommand request, CancellationToken cancellationToken)
		{
			return await Mediator.Send(request);
		}
 		[HttpGet]
 		public async Task<ApiResult<int>> DelShift([FromQuery]IShiftDelCommand request, CancellationToken cancellationToken)
 		{
 			return await Mediator.Send(request);
 		}
 		[HttpPost]
 		public async Task<ApiResult<int>> AddSchedule(ScheduleAddCommand request, CancellationToken cancellationToken)
 		{
 			return await Mediator.Send(request);
 		}
 		[HttpPost]
 		public async Task<ApiResult<int>> UpdSchedule(ScheduleUpdCommand request, CancellationToken cancellationToken)
 		{
 			return await Mediator.Send(request);
 		}
 		[HttpGet]
 		public async Task<ApiResult<int>> DelSchedule([FromQuery]ScheduleDelCommand request, CancellationToken cancellationToken)
 		{
 			return await Mediator.Send(request);
 		}
     }
 }
